<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Parser extends CI_Parser {

	/**
	 * Load header and footer
	 * This can be extended from plugins
	 **/
	function show($template, $data, $return = FALSE, $ajax = FALSE)
	{
		$CI =& get_instance();
		$header = $footer = "";

		if (!$ajax)
			$header = $CI->load->view('header', $data, TRUE);

		$content = $CI->load->view($template, $data, TRUE);

		if (!$ajax)
			$footer = $CI->load->view('footer', $data, TRUE);

		return $this->_parse($header.$content.$footer, $data, $return);
	}

	/**
	 * Load just content template
	 **/
	function ajax($template, $data, $return = FALSE) {
		return $this->show($template, $data, $return = FALSE, TRUE);
	}

}

 ?>
